// <copyright file="IUserRepository.cs" company="EnterpriseApi">
// Copyright (c) EnterpriseApi. All rights reserved.
// </copyright>

using EnterpriseApi.Models;

namespace EnterpriseApi.Repositories;

/// <summary>
/// 用户仓储接口，定义用户特有的数据访问操作
/// </summary>
public interface IUserRepository : IRepository<User>
{
    /// <summary>
    /// 根据用户名获取用户
    /// </summary>
    /// <param name="username">用户名</param>
    /// <returns>用户对象，如果不存在则返回null</returns>
    Task<User?> GetByUsernameAsync(string username);

    /// <summary>
    /// 根据邮箱获取用户
    /// </summary>
    /// <param name="email">邮箱地址</param>
    /// <returns>用户对象，如果不存在则返回null</returns>
    Task<User?> GetByEmailAsync(string email);

    /// <summary>
    /// 检查用户名是否已存在
    /// </summary>
    /// <param name="username">用户名</param>
    /// <returns>用户名是否已存在</returns>
    Task<bool> IsUsernameExistsAsync(string username);

    /// <summary>
    /// 检查邮箱是否已存在
    /// </summary>
    /// <param name="email">邮箱地址</param>
    /// <returns>邮箱是否已存在</returns>
    Task<bool> IsEmailExistsAsync(string email);

    /// <summary>
    /// 获取活跃用户列表
    /// </summary>
    /// <returns>活跃用户集合</returns>
    Task<IEnumerable<User>> GetActiveUsersAsync();

    /// <summary>
    /// 获取特定角色的用户列表
    /// </summary>
    /// <param name="roleId">角色ID</param>
    /// <returns>特定角色的用户集合</returns>
    Task<IEnumerable<User>> GetUsersByRoleAsync(int roleId);
}